<?php 
//邮件表单
?>
<?php 
    //create short variable names - 创建短变量名
    //trim 处理获取的值，去除额外字符
    $name=trim($_POST['name']);
    $email=trim($_POST['email']);
    $feedback=trim($_POST['feedback']);

    //set up some static information - 设置一些静态信息
    $toaddress = "feedback@example.com";

    $subject = "Feedback from web site";

    //  \r\n 回车换行
    $mailcontent =  "Customer name:".str_replace("\r\n", "", $name)."\n".
                    "Customer email:" .str_replace("\r\n", "", $email)."\n".
                    "Customer comments:\n".str_replace("\r\n", "", $feedback)."\n";

    $fromaddress = "From: webserver@example.com";

    //invoke mail() function to send mail - 调用mail（）函数发送邮件
    @mail($toaddress, $subject, $mailcontent, $fromaddress);
?>

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title>Bob`s Auto Parts - Feedback Submitted</title>

</head>

<body>
    <h1>Feedback Submitted - 提交的反馈</h1>
    <p>Your feedback has been sent. - 您的反馈已发送</p>

    <p>Your feedback (shown below) has been sent. - 您的反馈（如下所示）已发送</p>
    <p><?php echo nl2br(htmlspecialchars($feedback)); ?></p>
</body>